namespace QMVnSoft.Lists
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.Controls.ChildGridControls;
    using QMVnSoft.Properties;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormDmTsEditor : FormListEditor
    {
        private SearchColumn Column1;
        private DataGridViewTextBoxColumn Column2;
        private SearchColumn Column3;
        private NumericColumn Column4;
        private NumericColumn Column5;
        private NumericColumn Column6;
        private NumericColumn Column7;
        private IContainer components;
        private GridDetail grdDetail;
        private bool ib_PictureChanged;
        private string is_FixedAssetType = "C";
        private string is_PicturePath;
        private LabelControl lblCong_Suat;
        private LabelControl lblDesc_EN;
        private LabelControl lblDien_Giai;
        private LabelControl lblDvt;
        private LabelControl lblMa_Bp;
        private LabelControl lblMa_Km;
        private LabelControl lblMa_MDSD;
        private LabelControl lblMa_Nh_Ts;
        private LabelControl lblMa_Sp;
        private LabelControl lblMa_Ts;
        private LabelControl lblNam_Sx;
        private LabelControl lblNgay_KH;
        private LabelControl lblNgay_Ts;
        private LabelControl lblNuoc_Sx;
        private LabelControl lblSo_Ct_T;
        private LabelControl lblSo_Hieu;
        private LabelControl lblSo_Luong;
        private LabelControl lblSo_Thang;
        private LabelControl lblTen_Ts;
        private LabelControl lblTen_Ts_E;
        private LabelControl lblThe_Ts;
        private LabelControl lblTinh_KH;
        private LabelControl lblTinh_KH0;
        private LabelControl lblTk;
        private LabelControl lblTk_Co;
        private LabelControl lblTk_No;
        private LabelControl lblTTien0;
        private LabelControl lblTTien1;
        private LabelControl lblTTien2;
        private LabelControl lblTTien3;
        private DataTable oDetailTable;
        private DataRow oMasterRow;
        private DmTsDataAccess oMethod = new DmTsDataAccess();
        private System.Windows.Forms.PictureBox PictureBox;
        private Panel pnlPicture;
        private TextControl txtCong_Suat;
        private TextControl txtDesc_EN;
        private TextControl txtDien_Giai;
        private TextControl txtDvt;
        private TextSearch txtMa_Bp;
        private TextSearch txtMa_Km;
        private TextSearch txtMa_MDSD;
        private TextSearch txtMa_Nh_Ts;
        private TextSearch txtMa_Sp;
        private TextControl txtMa_Ts;
        private TextNumeric txtNam_Sx;
        private TextDate txtNgay_KH;
        private TextDate txtNgay_Ts;
        private TextControl txtNuoc_Sx;
        private TextControl txtSo_Ct_T;
        private TextControl txtSo_Hieu;
        private TextNumeric txtSo_Luong;
        private TextNumeric txtSo_Thang;
        private TextControl txtTen_Ts;
        private TextControl txtTen_Ts_E;
        private TextControl txtThe_Ts;
        private TextOption txtTinh_KH;
        private TextSearch txtTk;
        private TextSearch txtTk_Co;
        private TextSearch txtTk_No;
        private TextNumeric txtTTien0;
        private TextNumeric txtTTien1;
        private TextNumeric txtTTien2;
        private TextNumeric txtTTien3;

        public FormDmTsEditor()
        {
            this.InitializeComponent();
        }

        private bool AddNewRow(bool pb_Inserted)
        {
            if ((this.grdDetail.CurrentRow == null) || (this.grdDetail.CurrentRow.DataBoundItem == null))
            {
                return false;
            }
            if (((decimal) ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row["Tien0"]) == 0M)
            {
                return false;
            }
            if (this.grdDetail.CurrentRow.Index != (this.grdDetail.Rows.Count - 1))
            {
                return false;
            }
            this.grdDetail.EndEdit();
            DataRow row = this.oDetailTable.NewRow();
            row["Stt0"] = AppDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
            row["Tien0"] = 0;
            row["Tien1"] = 0;
            row["Loai_TGTS"] = "T";
            row["Tien3"] = 0;
            row["Tien4"] = 0;
            this.oDetailTable.Rows.Add(row);
            BindingSource dataSource = this.grdDetail.DataSource as BindingSource;
            dataSource.Position = dataSource.Find("Stt0", row["Stt0"]);
            return true;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void grdDetail_CellBottomLeftLeaved(object sender, EventArgs e)
        {
            if (((this.grdDetail.Rows.Count == 1) || !string.IsNullOrEmpty(((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row["Ma_TGTS"].ToString())) || !string.IsNullOrEmpty(base.ActiveControl.Text))
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.NextCell;
            }
            else
            {
                this.txtTinh_KH.Focus();
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.DeleteCurrentRow;
            }
        }

        private void grdDetail_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 3)
            {
                this.Sum();
            }
        }

        private void grdDetail_CellRightLeaved(object sender, EventArgs e)
        {
            if (this.AddNewRow(false))
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.FirstCell;
            }
            else
            {
                this.grdDetail.UserMoveNextCell = GridDetail.MoveNextType.FirstCellNextRow;
            }
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormDmTsEditor));
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle style2 = new DataGridViewCellStyle();
            DataGridViewCellStyle style3 = new DataGridViewCellStyle();
            DataGridViewCellStyle style4 = new DataGridViewCellStyle();
            DataGridViewCellStyle style5 = new DataGridViewCellStyle();
            DataGridViewCellStyle style6 = new DataGridViewCellStyle();
            this.txtMa_Ts = new TextControl();
            this.lblMa_Ts = new LabelControl();
            this.txtTen_Ts = new TextControl();
            this.lblTen_Ts = new LabelControl();
            this.txtTen_Ts_E = new TextControl();
            this.lblTen_Ts_E = new LabelControl();
            this.txtDvt = new TextControl();
            this.lblDvt = new LabelControl();
            this.lblTk = new LabelControl();
            this.txtTk = new TextSearch();
            this.lblMa_Nh_Ts = new LabelControl();
            this.txtMa_Nh_Ts = new TextSearch();
            this.lblMa_MDSD = new LabelControl();
            this.txtMa_MDSD = new TextSearch();
            this.lblMa_Bp = new LabelControl();
            this.txtMa_Bp = new TextSearch();
            this.pnlPicture = new Panel();
            this.PictureBox = new System.Windows.Forms.PictureBox();
            this.txtThe_Ts = new TextControl();
            this.lblThe_Ts = new LabelControl();
            this.txtSo_Hieu = new TextControl();
            this.lblSo_Hieu = new LabelControl();
            this.txtSo_Luong = new TextNumeric();
            this.lblSo_Luong = new LabelControl();
            this.txtSo_Ct_T = new TextControl();
            this.lblSo_Ct_T = new LabelControl();
            this.txtNgay_Ts = new TextDate();
            this.lblNgay_Ts = new LabelControl();
            this.txtNuoc_Sx = new TextControl();
            this.lblNuoc_Sx = new LabelControl();
            this.lblNam_Sx = new LabelControl();
            this.txtNam_Sx = new TextNumeric();
            this.txtCong_Suat = new TextControl();
            this.lblCong_Suat = new LabelControl();
            this.grdDetail = new GridDetail();
            this.txtDien_Giai = new TextControl();
            this.txtDesc_EN = new TextControl();
            this.lblDien_Giai = new LabelControl();
            this.lblDesc_EN = new LabelControl();
            this.txtTinh_KH = new TextOption();
            this.lblTinh_KH = new LabelControl();
            this.lblTinh_KH0 = new LabelControl();
            this.lblTTien2 = new LabelControl();
            this.txtTTien2 = new TextNumeric();
            this.lblTTien3 = new LabelControl();
            this.txtTTien3 = new TextNumeric();
            this.lblTTien1 = new LabelControl();
            this.txtTTien1 = new TextNumeric();
            this.lblTTien0 = new LabelControl();
            this.txtTTien0 = new TextNumeric();
            this.lblNgay_KH = new LabelControl();
            this.txtNgay_KH = new TextDate();
            this.lblSo_Thang = new LabelControl();
            this.txtSo_Thang = new TextNumeric();
            this.lblMa_Sp = new LabelControl();
            this.lblTk_Co = new LabelControl();
            this.lblTk_No = new LabelControl();
            this.lblMa_Km = new LabelControl();
            this.txtMa_Sp = new TextSearch();
            this.txtTk_Co = new TextSearch();
            this.txtTk_No = new TextSearch();
            this.txtMa_Km = new TextSearch();
            this.Column1 = new SearchColumn();
            this.Column2 = new DataGridViewTextBoxColumn();
            this.Column3 = new SearchColumn();
            this.Column4 = new NumericColumn();
            this.Column5 = new NumericColumn();
            this.Column6 = new NumericColumn();
            this.Column7 = new NumericColumn();
            this.pnlPicture.SuspendLayout();
            ((ISupportInitialize) this.PictureBox).BeginInit();
            ((ISupportInitialize) this.grdDetail).BeginInit();
            base.SuspendLayout();
            base.txtMa_Loai3.FirstFilter = "Type = 'TS3'";
            base.txtMa_Loai3.Location = new Point(0x235, 0x1f6);
            base.txtMa_Loai3.Size = new Size(0xdb, 20);
            base.txtMa_Loai3.TabIndex = 0x21;
            base.txtMa_Loai2.FirstFilter = "Type = 'TS2'";
            base.txtMa_Loai2.Location = new Point(0x157, 0x1f6);
            base.txtMa_Loai2.Size = new Size(0xdd, 20);
            base.txtMa_Loai2.TabIndex = 0x20;
            base.txtMa_Loai1.FirstFilter = "Type = 'TS1'";
            base.txtMa_Loai1.Location = new Point(0x7b, 0x1f6);
            base.txtMa_Loai1.Size = new Size(0xdb, 20);
            base.txtMa_Loai1.TabIndex = 0x1f;
            base.lblPhan_Loai.Location = new Point(12, 0x1f9);
            this.txtMa_Ts.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Ts.CheckTextSearched = false;
            this.txtMa_Ts.DisabledForeColor = Color.Empty;
            this.txtMa_Ts.Font = new Font("Arial", 8.25f);
            this.txtMa_Ts.Location = new Point(0x7b, 0x1c);
            this.txtMa_Ts.MaxLength = 0x20;
            this.txtMa_Ts.Name = "txtMa_Ts";
            this.txtMa_Ts.OldValue = null;
            this.txtMa_Ts.Size = new Size(100, 20);
            this.txtMa_Ts.TabIndex = 0;
            this.txtMa_Ts.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Ts.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Ts.Value = null;//manager.GetObject("txtMa_Ts.Value");
            this.lblMa_Ts.AutoSize = true;
            this.lblMa_Ts.Font = new Font("Arial", 8.25f);
            this.lblMa_Ts.Location = new Point(12, 0x1f);
            this.lblMa_Ts.Name = "lblMa_Ts";
            this.lblMa_Ts.Size = new Size(0x38, 14);
            this.lblMa_Ts.TabIndex = 4;
            this.lblMa_Ts.Text = "Mã tài sản";
            this.txtTen_Ts.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Ts.CheckTextSearched = false;
            this.txtTen_Ts.DisabledForeColor = Color.Empty;
            this.txtTen_Ts.Font = new Font("Arial", 8.25f);
            this.txtTen_Ts.Location = new Point(0x7b, 0x31);
            this.txtTen_Ts.MaxLength = 128;
            this.txtTen_Ts.Name = "txtTen_Ts";
            this.txtTen_Ts.OldValue = null;
            this.txtTen_Ts.Size = new Size(0x1ac, 20);
            this.txtTen_Ts.TabIndex = 3;
            this.txtTen_Ts.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Ts.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTen_Ts.Value = null;//manager.GetObject("txtTen_Ts.Value");
            this.lblTen_Ts.AutoSize = true;
            this.lblTen_Ts.Font = new Font("Arial", 8.25f);
            this.lblTen_Ts.Location = new Point(12, 0x34);
            this.lblTen_Ts.Name = "lblTen_Ts";
            this.lblTen_Ts.Size = new Size(60, 14);
            this.lblTen_Ts.TabIndex = 4;
            this.lblTen_Ts.Text = "Tên tài sản";
            this.txtTen_Ts_E.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Ts_E.CheckTextSearched = false;
            this.txtTen_Ts_E.DisabledForeColor = Color.Empty;
            this.txtTen_Ts_E.Font = new Font("Arial", 8.25f);
            this.txtTen_Ts_E.Location = new Point(0x7b, 70);
            this.txtTen_Ts_E.MaxLength = 128;
            this.txtTen_Ts_E.Name = "txtTen_Ts_E";
            this.txtTen_Ts_E.OldValue = null;
            this.txtTen_Ts_E.Size = new Size(0x1ac, 20);
            this.txtTen_Ts_E.TabIndex = 4;
            this.txtTen_Ts_E.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Ts_E.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTen_Ts_E.Value = null;//manager.GetObject("txtTen_Ts_E.Value");
            this.lblTen_Ts_E.AutoSize = true;
            this.lblTen_Ts_E.Font = new Font("Arial", 8.25f);
            this.lblTen_Ts_E.Location = new Point(12, 0x49);
            this.lblTen_Ts_E.Name = "lblTen_Ts_E";
            this.lblTen_Ts_E.Size = new Size(0x4a, 14);
            this.lblTen_Ts_E.TabIndex = 4;
            this.lblTen_Ts_E.Text = "Tên tiếng Anh";
            this.txtDvt.CheckTextSearched = false;
            this.txtDvt.DisabledForeColor = Color.Empty;
            this.txtDvt.Font = new Font("Arial", 8.25f);
            this.txtDvt.Location = new Point(0x7b, 0x5b);
            this.txtDvt.MaxLength = 20;
            this.txtDvt.Name = "txtDvt";
            this.txtDvt.OldValue = null;
            this.txtDvt.Size = new Size(100, 20);
            this.txtDvt.TabIndex = 5;
            this.txtDvt.UserTextLength = AppInstance.TextControlLength.ItemUnit;
            this.txtDvt.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtDvt.Value = null;//manager.GetObject("txtDvt.Value");
            this.lblDvt.AutoSize = true;
            this.lblDvt.Font = new Font("Arial", 8.25f);
            this.lblDvt.Location = new Point(12, 0x5e);
            this.lblDvt.Name = "lblDvt";
            this.lblDvt.Size = new Size(0x3b, 14);
            this.lblDvt.TabIndex = 4;
            this.lblDvt.Text = "Đơn vị tính";
            this.lblTk.AutoSize = true;
            this.lblTk.Font = new Font("Arial", 8.25f);
            this.lblTk.Location = new Point(12, 0xc7);
            this.lblTk.Name = "lblTk";
            this.lblTk.Size = new Size(0x58, 14);
            this.lblTk.TabIndex = 4;
            this.lblTk.Text = "Tài khoản tài sản";
            this.txtTk.CharacterCasing = CharacterCasing.Upper;
            this.txtTk.CheckTextSearched = false;
            this.txtTk.DisabledForeColor = Color.Empty;
            this.txtTk.FirstFilter = "Loai_Tk = 'C'";
            this.txtTk.Font = new Font("Arial", 8.25f);
            this.txtTk.Location = new Point(0x7b, 0xc4);
            this.txtTk.MaxLength = 0x20;
            this.txtTk.Name = "txtTk";
            this.txtTk.OldValue = null;
            this.txtTk.Size = new Size(100, 20);
            this.txtTk.TabIndex = 14;
            this.txtTk.TableName = "DMTK";
            this.txtTk.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtTk.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk.Value = null;//manager.GetObject("txtTk.Value");
            this.lblMa_Nh_Ts.AutoSize = true;
            this.lblMa_Nh_Ts.Font = new Font("Arial", 8.25f);
            this.lblMa_Nh_Ts.Location = new Point(12, 0xb2);
            this.lblMa_Nh_Ts.Name = "lblMa_Nh_Ts";
            this.lblMa_Nh_Ts.Size = new Size(0x45, 14);
            this.lblMa_Nh_Ts.TabIndex = 4;
            this.lblMa_Nh_Ts.Text = "Nhóm tài sản";
            this.txtMa_Nh_Ts.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Nh_Ts.CheckTextSearched = false;
            this.txtMa_Nh_Ts.DisabledForeColor = Color.Empty;
            this.txtMa_Nh_Ts.FirstFilter = "Nh_Cuoi_Ts = 'C'";
            this.txtMa_Nh_Ts.Font = new Font("Arial", 8.25f);
            this.txtMa_Nh_Ts.Location = new Point(0x7b, 0xaf);
            this.txtMa_Nh_Ts.MaxLength = 0x20;
            this.txtMa_Nh_Ts.Name = "txtMa_Nh_Ts";
            this.txtMa_Nh_Ts.OldValue = null;
            this.txtMa_Nh_Ts.Size = new Size(100, 20);
            this.txtMa_Nh_Ts.TabIndex = 12;
            this.txtMa_Nh_Ts.TableName = "DMNHTS";
            this.txtMa_Nh_Ts.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nh_Ts.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Nh_Ts.Value = null;//manager.GetObject("txtMa_Nh_Ts.Value");
            this.lblMa_MDSD.AutoSize = true;
            this.lblMa_MDSD.Font = new Font("Arial", 8.25f);
            this.lblMa_MDSD.Location = new Point(0x160, 0xb2);
            this.lblMa_MDSD.Name = "lblMa_MDSD";
            this.lblMa_MDSD.Size = new Size(0x5d, 14);
            this.lblMa_MDSD.TabIndex = 4;
            this.lblMa_MDSD.Text = "Mục đích sử dụng";
            this.txtMa_MDSD.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_MDSD.CheckTextSearched = false;
            this.txtMa_MDSD.DisabledForeColor = Color.Empty;
            this.txtMa_MDSD.Font = new Font("Arial", 8.25f);
            this.txtMa_MDSD.Location = new Point(0x1c3, 0xaf);
            this.txtMa_MDSD.MaxLength = 0x20;
            this.txtMa_MDSD.Name = "txtMa_MDSD";
            this.txtMa_MDSD.OldValue = null;
            this.txtMa_MDSD.Size = new Size(100, 20);
            this.txtMa_MDSD.TabIndex = 13;
            this.txtMa_MDSD.TableName = "DMMDSD";
            this.txtMa_MDSD.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_MDSD.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_MDSD.Value = null;//manager.GetObject("txtMa_MDSD.Value");
            this.lblMa_Bp.AutoSize = true;
            this.lblMa_Bp.Font = new Font("Arial", 8.25f);
            this.lblMa_Bp.Location = new Point(0x163, 0xc7);
            this.lblMa_Bp.Name = "lblMa_Bp";
            this.lblMa_Bp.Size = new Size(90, 14);
            this.lblMa_Bp.TabIndex = 4;
            this.lblMa_Bp.Text = "Bộ phận sử dụng";
            this.txtMa_Bp.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Bp.CheckTextSearched = false;
            this.txtMa_Bp.DisabledForeColor = Color.Empty;
            this.txtMa_Bp.Font = new Font("Arial", 8.25f);
            this.txtMa_Bp.Location = new Point(0x1c3, 0xc4);
            this.txtMa_Bp.MaxLength = 0x20;
            this.txtMa_Bp.Name = "txtMa_Bp";
            this.txtMa_Bp.OldValue = null;
            this.txtMa_Bp.Size = new Size(100, 20);
            this.txtMa_Bp.TabIndex = 15;
            this.txtMa_Bp.TableName = "DMBP";
            this.txtMa_Bp.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Bp.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Bp.Value = null;//manager.GetObject("txtMa_Bp.Value");
            this.pnlPicture.BackColor = SystemColors.Desktop;
            this.pnlPicture.BorderStyle = BorderStyle.Fixed3D;
            this.pnlPicture.Controls.Add(this.PictureBox);
            this.pnlPicture.Location = new Point(0x22d, 0x1c);
            this.pnlPicture.Name = "pnlPicture";
            this.pnlPicture.Size = new Size(0xe3, 0xc1);
            this.pnlPicture.TabIndex = 12;
            this.PictureBox.BackgroundImage = Resources.NoPicture;
            this.PictureBox.BackgroundImageLayout = ImageLayout.Stretch;
            this.PictureBox.Location = new Point(3, 3);
            this.PictureBox.Name = "PictureBox";
            this.PictureBox.Size = new Size(0xd9, 0xb7);
            this.PictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            this.PictureBox.TabIndex = 0;
            this.PictureBox.TabStop = false;
            this.PictureBox.DoubleClick += new EventHandler(this.PictureBox_DoubleClick);
            this.txtThe_Ts.CharacterCasing = CharacterCasing.Upper;
            this.txtThe_Ts.CheckTextSearched = false;
            this.txtThe_Ts.DisabledForeColor = Color.Empty;
            this.txtThe_Ts.Font = new Font("Arial", 8.25f);
            this.txtThe_Ts.Location = new Point(0x127, 0x1c);
            this.txtThe_Ts.MaxLength = 0x20;
            this.txtThe_Ts.Name = "txtThe_Ts";
            this.txtThe_Ts.OldValue = null;
            this.txtThe_Ts.Size = new Size(100, 20);
            this.txtThe_Ts.TabIndex = 1;
            this.txtThe_Ts.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtThe_Ts.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtThe_Ts.Value = null;//manager.GetObject("txtThe_Ts.Value");
            this.lblThe_Ts.AutoSize = true;
            this.lblThe_Ts.Font = new Font("Arial", 8.25f);
            this.lblThe_Ts.Location = new Point(0xe5, 0x1f);
            this.lblThe_Ts.Name = "lblThe_Ts";
            this.lblThe_Ts.Size = new Size(60, 14);
            this.lblThe_Ts.TabIndex = 4;
            this.lblThe_Ts.Text = "Thẻ tài sản";
            this.txtSo_Hieu.CharacterCasing = CharacterCasing.Upper;
            this.txtSo_Hieu.CheckTextSearched = false;
            this.txtSo_Hieu.DisabledForeColor = Color.Empty;
            this.txtSo_Hieu.Font = new Font("Arial", 8.25f);
            this.txtSo_Hieu.Location = new Point(0x1c3, 0x1c);
            this.txtSo_Hieu.MaxLength = 0x20;
            this.txtSo_Hieu.Name = "txtSo_Hieu";
            this.txtSo_Hieu.OldValue = null;
            this.txtSo_Hieu.Size = new Size(100, 20);
            this.txtSo_Hieu.TabIndex = 2;
            this.txtSo_Hieu.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtSo_Hieu.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtSo_Hieu.Value = null;//manager.GetObject("txtSo_Hieu.Value");
            this.lblSo_Hieu.AutoSize = true;
            this.lblSo_Hieu.Font = new Font("Arial", 8.25f);
            this.lblSo_Hieu.Location = new Point(0x192, 0x1f);
            this.lblSo_Hieu.Name = "lblSo_Hieu";
            this.lblSo_Hieu.Size = new Size(0x2b, 14);
            this.lblSo_Hieu.TabIndex = 4;
            this.lblSo_Hieu.Text = "Số hiệu";
            this.txtSo_Luong.Font = new Font("Arial", 8.25f);
            this.txtSo_Luong.Location = new Point(0x1c3, 0x5b);
            this.txtSo_Luong.Name = "txtSo_Luong";
            int[] bits = new int[4];
            this.txtSo_Luong.NumericValue = new decimal(bits);
            this.txtSo_Luong.OldValue = null;
            this.txtSo_Luong.Size = new Size(100, 20);
            this.txtSo_Luong.TabIndex = 6;
            this.txtSo_Luong.TextAlign = HorizontalAlignment.Right;
            this.txtSo_Luong.UserTextNumericFormat = AppInstance.TextNumericFormat.Quantity;
//            this.txtSo_Luong.Value = null;//manager.GetObject("txtSo_Luong.Value");
            this.lblSo_Luong.AutoSize = true;
            this.lblSo_Luong.Font = new Font("Arial", 8.25f);
            this.lblSo_Luong.Location = new Point(0x18a, 0x5e);
            this.lblSo_Luong.Name = "lblSo_Luong";
            this.lblSo_Luong.Size = new Size(0x33, 14);
            this.lblSo_Luong.TabIndex = 0x27;
            this.lblSo_Luong.Text = "Số lượng";
            this.txtSo_Ct_T.CheckTextSearched = false;
            this.txtSo_Ct_T.DisabledForeColor = Color.Empty;
            this.txtSo_Ct_T.Font = new Font("Arial", 8.25f);
            this.txtSo_Ct_T.Location = new Point(0x7b, 0x70);
            this.txtSo_Ct_T.MaxLength = 20;
            this.txtSo_Ct_T.Name = "txtSo_Ct_T";
            this.txtSo_Ct_T.OldValue = null;
            this.txtSo_Ct_T.Size = new Size(100, 20);
            this.txtSo_Ct_T.TabIndex = 7;
            this.txtSo_Ct_T.UserTextLength = AppInstance.TextControlLength.ItemUnit;
            this.txtSo_Ct_T.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtSo_Ct_T.Value = null;//manager.GetObject("txtSo_Ct_T.Value");
            this.lblSo_Ct_T.AutoSize = true;
            this.lblSo_Ct_T.Font = new Font("Arial", 8.25f);
            this.lblSo_Ct_T.Location = new Point(12, 0x73);
            this.lblSo_Ct_T.Name = "lblSo_Ct_T";
            this.lblSo_Ct_T.Size = new Size(0x43, 14);
            this.lblSo_Ct_T.TabIndex = 4;
            this.lblSo_Ct_T.Text = "Số chứng từ";
            this.txtNgay_Ts.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ts.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ts.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ts.Location = new Point(0x1c3, 0x70);
            this.txtNgay_Ts.Mask = "00/00/0000";
            this.txtNgay_Ts.Name = "txtNgay_Ts";
            this.txtNgay_Ts.OldValue = null;
            this.txtNgay_Ts.Size = new Size(100, 20);
            this.txtNgay_Ts.TabIndex = 8;
//            this.txtNgay_Ts.Value = null;//manager.GetObject("txtNgay_Ts.Value");
            this.lblNgay_Ts.AutoSize = true;
            this.lblNgay_Ts.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ts.Location = new Point(0x185, 0x73);
            this.lblNgay_Ts.Name = "lblNgay_Ts";
            this.lblNgay_Ts.Size = new Size(0x38, 14);
            this.lblNgay_Ts.TabIndex = 0x27;
            this.lblNgay_Ts.Text = "Ngày tăng";
            this.txtNuoc_Sx.CheckTextSearched = false;
            this.txtNuoc_Sx.DisabledForeColor = Color.Empty;
            this.txtNuoc_Sx.Font = new Font("Arial", 8.25f);
            this.txtNuoc_Sx.Location = new Point(0x7b, 0x85);
            this.txtNuoc_Sx.MaxLength = 20;
            this.txtNuoc_Sx.Name = "txtNuoc_Sx";
            this.txtNuoc_Sx.OldValue = null;
            this.txtNuoc_Sx.Size = new Size(0xda, 20);
            this.txtNuoc_Sx.TabIndex = 9;
            this.txtNuoc_Sx.UserTextLength = AppInstance.TextControlLength.ItemUnit;
            this.txtNuoc_Sx.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtNuoc_Sx.Value = null;//manager.GetObject("txtNuoc_Sx.Value");
            this.lblNuoc_Sx.AutoSize = true;
            this.lblNuoc_Sx.Font = new Font("Arial", 8.25f);
            this.lblNuoc_Sx.Location = new Point(12, 0x88);
            this.lblNuoc_Sx.Name = "lblNuoc_Sx";
            this.lblNuoc_Sx.Size = new Size(0x4f, 14);
            this.lblNuoc_Sx.TabIndex = 4;
            this.lblNuoc_Sx.Text = "Nước sản xuất";
            this.lblNam_Sx.AutoSize = true;
            this.lblNam_Sx.Font = new Font("Arial", 8.25f);
            this.lblNam_Sx.Location = new Point(0x174, 0x88);
            this.lblNam_Sx.Name = "lblNam_Sx";
            this.lblNam_Sx.Size = new Size(0x49, 14);
            this.lblNam_Sx.TabIndex = 0x27;
            this.lblNam_Sx.Text = "Năm sản xuất";
            this.txtNam_Sx.Font = new Font("Arial", 8.25f);
            this.txtNam_Sx.Location = new Point(0x1c3, 0x85);
            this.txtNam_Sx.Name = "txtNam_Sx";
            this.txtNam_Sx.NumericPrecision = 4;
            this.txtNam_Sx.NumericScaleOnFocus = 0;
            this.txtNam_Sx.NumericScaleOnLostFocus = 0;
            int[] numArray2 = new int[4];
            this.txtNam_Sx.NumericValue = new decimal(numArray2);
            this.txtNam_Sx.OldValue = null;
            this.txtNam_Sx.Size = new Size(100, 20);
            this.txtNam_Sx.TabIndex = 10;
            this.txtNam_Sx.TextAlign = HorizontalAlignment.Right;
//            this.txtNam_Sx.Value = null;//manager.GetObject("txtNam_Sx.Value");
            this.txtCong_Suat.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtCong_Suat.CheckTextSearched = false;
            this.txtCong_Suat.DisabledForeColor = Color.Empty;
            this.txtCong_Suat.Font = new Font("Arial", 8.25f);
            this.txtCong_Suat.Location = new Point(0x7b, 0x9a);
            this.txtCong_Suat.MaxLength = 128;
            this.txtCong_Suat.Name = "txtCong_Suat";
            this.txtCong_Suat.OldValue = null;
            this.txtCong_Suat.Size = new Size(0x1ac, 20);
            this.txtCong_Suat.TabIndex = 11;
            this.txtCong_Suat.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtCong_Suat.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtCong_Suat.Value = null;//manager.GetObject("txtCong_Suat.Value");
            this.lblCong_Suat.AutoSize = true;
            this.lblCong_Suat.Font = new Font("Arial", 8.25f);
            this.lblCong_Suat.Location = new Point(12, 0x9d);
            this.lblCong_Suat.Name = "lblCong_Suat";
            this.lblCong_Suat.Size = new Size(0x38, 14);
            this.lblCong_Suat.TabIndex = 4;
            this.lblCong_Suat.Text = "Công suất";
            this.grdDetail.AllowUserToAddRows = false;
            this.grdDetail.AllowUserToDeleteRows = false;
            this.grdDetail.CheckAutoSize = true;
            this.grdDetail.CheckColor = false;
            this.grdDetail.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.grdDetail.Columns.AddRange(new DataGridViewColumn[] { this.Column1, this.Column2, this.Column3, this.Column4, this.Column5, this.Column6, this.Column7 });
            this.grdDetail.Font = new Font("Arial", 8.25f);
            this.grdDetail.Location = new Point(0, 0xde);
            this.grdDetail.Name = "grdDetail";
            this.grdDetail.Size = new Size(0x31c, 190);
            this.grdDetail.TabIndex = 0x10;
            this.grdDetail.CellRightLeaved += new EventHandler(this.grdDetail_CellRightLeaved);
            this.grdDetail.CellBottomLeftLeaved += new EventHandler(this.grdDetail_CellBottomLeftLeaved);
            this.grdDetail.CellEndEdit += new DataGridViewCellEventHandler(this.grdDetail_CellEndEdit);
            this.txtDien_Giai.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = Color.Empty;
            this.txtDien_Giai.Font = new Font("Arial", 8.25f);
            this.txtDien_Giai.Location = new Point(0x7b, 0x178);
            this.txtDien_Giai.MaxLength = 128;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new Size(0x295, 20);
            this.txtDien_Giai.TabIndex = 0x12;
            this.txtDien_Giai.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtDien_Giai.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtDien_Giai.Value = null;//manager.GetObject("txtDien_Giai.Value");
            this.txtDien_Giai.Visible = false;
            this.txtDesc_EN.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = Color.Empty;
            this.txtDesc_EN.Font = new Font("Arial", 8.25f);
            this.txtDesc_EN.Location = new Point(0x7b, 0x18d);
            this.txtDesc_EN.MaxLength = 128;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new Size(0x295, 20);
            this.txtDesc_EN.TabIndex = 0x13;
            this.txtDesc_EN.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtDesc_EN.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtDesc_EN.Value = null;//manager.GetObject("txtDesc_EN.Value");
            this.txtDesc_EN.Visible = false;
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new Font("Arial", 8.25f);
            this.lblDien_Giai.Location = new Point(12, 0x17b);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new Size(0x2c, 14);
            this.lblDien_Giai.TabIndex = 0x11;
            this.lblDien_Giai.Text = "Ghi ch\x00fa";
            this.lblDien_Giai.Visible = false;
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new Font("Arial", 8.25f);
            this.lblDesc_EN.Location = new Point(12, 400);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new Size(0x5d, 14);
            this.lblDesc_EN.TabIndex = 4;
            this.lblDesc_EN.Text = "Ghi ch\x00fa tiếng Anh";
            this.lblDesc_EN.Visible = false;
            this.txtTinh_KH.CheckTextSearched = false;
            this.txtTinh_KH.DisabledForeColor = Color.Blue;
            this.txtTinh_KH.Font = new Font("Arial", 8.25f);
            this.txtTinh_KH.InputMask = "C,K";
            this.txtTinh_KH.Location = new Point(0x7b, 0x1a2);
            this.txtTinh_KH.Name = "txtTinh_KH";
            this.txtTinh_KH.OldValue = null;
            this.txtTinh_KH.Size = new Size(0x19, 20);
            this.txtTinh_KH.TabIndex = 20;
            this.txtTinh_KH.Text = "C";
            this.txtTinh_KH.Value = "C";
            this.lblTinh_KH.AutoSize = true;
            this.lblTinh_KH.Font = new Font("Arial", 8.25f);
            this.lblTinh_KH.Location = new Point(12, 0x1a5);
            this.lblTinh_KH.Name = "lblTinh_KH";
            this.lblTinh_KH.Size = new Size(0x4a, 14);
            this.lblTinh_KH.TabIndex = 4;
            this.lblTinh_KH.Text = "Tính khấu hao";
            this.lblTinh_KH0.AutoSize = true;
            this.lblTinh_KH0.Font = new Font("Arial", 8.25f);
            this.lblTinh_KH0.ForeColor = Color.Blue;
            this.lblTinh_KH0.Location = new Point(0x9a, 0x1a5);
            this.lblTinh_KH0.Name = "lblTinh_KH0";
            this.lblTinh_KH0.Size = new Size(0xd5, 14);
            this.lblTinh_KH0.TabIndex = 4;
            this.lblTinh_KH0.Text = "C-C\x00f3 tính khấu hao, K-Không tính khấu hao";
            this.lblTTien2.AutoSize = true;
            this.lblTTien2.Font = new Font("Arial", 8.25f);
            this.lblTTien2.Location = new Point(0x24f, 0x1e5);
            this.lblTTien2.Name = "lblTTien2";
            this.lblTTien2.Size = new Size(0x53, 14);
            this.lblTTien2.TabIndex = 0x27;
            this.lblTTien2.Text = "Khấu hao tháng";
            this.txtTTien2.Font = new Font("Arial", 8.25f);
            this.txtTTien2.Location = new Point(0x2ac, 0x1e1);
            this.txtTTien2.Name = "txtTTien2";
            int[] numArray3 = new int[4];
            this.txtTTien2.NumericValue = new decimal(numArray3);
            this.txtTTien2.OldValue = null;
            this.txtTTien2.Size = new Size(100, 20);
            this.txtTTien2.TabIndex = 30;
            this.txtTTien2.TextAlign = HorizontalAlignment.Right;
            this.txtTTien2.UserTextNumericFormat = AppInstance.TextNumericFormat.Quantity;
//            this.txtTTien2.Value = null;//manager.GetObject("txtTTien2.Value");
            this.lblTTien3.AutoSize = true;
            this.lblTTien3.Font = new Font("Arial", 8.25f);
            this.lblTTien3.Location = new Point(0x24f, 0x1d0);
            this.lblTTien3.Name = "lblTTien3";
            this.lblTTien3.Size = new Size(0x45, 14);
            this.lblTTien3.TabIndex = 0x27;
            this.lblTTien3.Text = "Giá trị còn lại";
            this.txtTTien3.Enabled = false;
            this.txtTTien3.Font = new Font("Arial", 8.25f);
            this.txtTTien3.Location = new Point(0x2ac, 460);
            this.txtTTien3.Name = "txtTTien3";
            int[] numArray4 = new int[4];
            this.txtTTien3.NumericValue = new decimal(numArray4);
            this.txtTTien3.OldValue = null;
            this.txtTTien3.Size = new Size(100, 20);
            this.txtTTien3.TabIndex = 0x1b;
            this.txtTTien3.TextAlign = HorizontalAlignment.Right;
            this.txtTTien3.UserTextNumericFormat = AppInstance.TextNumericFormat.Quantity;
//            this.txtTTien3.Value = null;//manager.GetObject("txtTTien3.Value");
            this.lblTTien1.AutoSize = true;
            this.lblTTien1.Font = new Font("Arial", 8.25f);
            this.lblTTien1.Location = new Point(0x24f, 0x1bb);
            this.lblTTien1.Name = "lblTTien1";
            this.lblTTien1.Size = new Size(0x4f, 14);
            this.lblTTien1.TabIndex = 0x27;
            this.lblTTien1.Text = "Giá trị hao m\x00f2n";
            this.txtTTien1.Enabled = false;
            this.txtTTien1.Font = new Font("Arial", 8.25f);
            this.txtTTien1.Location = new Point(0x2ac, 0x1b7);
            this.txtTTien1.Name = "txtTTien1";
            int[] numArray5 = new int[4];
            this.txtTTien1.NumericValue = new decimal(numArray5);
            this.txtTTien1.OldValue = null;
            this.txtTTien1.Size = new Size(100, 20);
            this.txtTTien1.TabIndex = 0x18;
            this.txtTTien1.TextAlign = HorizontalAlignment.Right;
            this.txtTTien1.UserTextNumericFormat = AppInstance.TextNumericFormat.Quantity;
//            this.txtTTien1.Value = null;//manager.GetObject("txtTTien1.Value");
            this.lblTTien0.AutoSize = true;
            this.lblTTien0.Font = new Font("Arial", 8.25f);
            this.lblTTien0.Location = new Point(0x24f, 0x1a6);
            this.lblTTien0.Name = "lblTTien0";
            this.lblTTien0.Size = new Size(0x57, 14);
            this.lblTTien0.TabIndex = 0x27;
            this.lblTTien0.Text = "Tổng nguyên giá";
            this.txtTTien0.Enabled = false;
            this.txtTTien0.Font = new Font("Arial", 8.25f);
            this.txtTTien0.Location = new Point(0x2ac, 0x1a2);
            this.txtTTien0.Name = "txtTTien0";
            int[] numArray6 = new int[4];
            this.txtTTien0.NumericValue = new decimal(numArray6);
            this.txtTTien0.OldValue = null;
            this.txtTTien0.Size = new Size(100, 20);
            this.txtTTien0.TabIndex = 0x15;
            this.txtTTien0.TextAlign = HorizontalAlignment.Right;
            this.txtTTien0.UserTextNumericFormat = AppInstance.TextNumericFormat.Quantity;
//            this.txtTTien0.Value = null;//manager.GetObject("txtTTien0.Value");
            this.lblNgay_KH.AutoSize = true;
            this.lblNgay_KH.Font = new Font("Arial", 8.25f);
            this.lblNgay_KH.Location = new Point(12, 0x1bb);
            this.lblNgay_KH.Name = "lblNgay_KH";
            this.lblNgay_KH.Size = new Size(0x4f, 14);
            this.lblNgay_KH.TabIndex = 0x27;
            this.lblNgay_KH.Text = "Ngày khấu hao";
            this.txtNgay_KH.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_KH.Font = new Font("Arial", 8.25f);
            this.txtNgay_KH.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_KH.Location = new Point(0x7b, 0x1b7);
            this.txtNgay_KH.Mask = "00/00/0000";
            this.txtNgay_KH.Name = "txtNgay_KH";
            this.txtNgay_KH.OldValue = null;
            this.txtNgay_KH.Size = new Size(100, 20);
            this.txtNgay_KH.TabIndex = 0x16;
//            this.txtNgay_KH.Value = null;//manager.GetObject("txtNgay_KH.Value");
            this.lblSo_Thang.AutoSize = true;
            this.lblSo_Thang.Font = new Font("Arial", 8.25f);
            this.lblSo_Thang.Location = new Point(0x15c, 0x1ba);
            this.lblSo_Thang.Name = "lblSo_Thang";
            this.lblSo_Thang.Size = new Size(0x61, 14);
            this.lblSo_Thang.TabIndex = 0x27;
            this.lblSo_Thang.Text = "Số tháng khấu hao";
            this.txtSo_Thang.Font = new Font("Arial", 8.25f);
            this.txtSo_Thang.Location = new Point(0x1c3, 0x1b7);
            this.txtSo_Thang.Name = "txtSo_Thang";
            this.txtSo_Thang.NumericScaleOnFocus = 0;
            this.txtSo_Thang.NumericScaleOnLostFocus = 0;
            int[] numArray7 = new int[4];
            this.txtSo_Thang.NumericValue = new decimal(numArray7);
            this.txtSo_Thang.OldValue = null;
            this.txtSo_Thang.Size = new Size(100, 20);
            this.txtSo_Thang.TabIndex = 0x17;
            this.txtSo_Thang.TextAlign = HorizontalAlignment.Right;
//            this.txtSo_Thang.Value = null;//manager.GetObject("txtSo_Thang.Value");
            this.txtSo_Thang.Validated += new EventHandler(this.txtSo_Thang_Validated);
            this.lblMa_Sp.AutoSize = true;
            this.lblMa_Sp.Font = new Font("Arial", 8.25f);
            this.lblMa_Sp.Location = new Point(12, 0x1e4);
            this.lblMa_Sp.Name = "lblMa_Sp";
            this.lblMa_Sp.Size = new Size(0x47, 14);
            this.lblMa_Sp.TabIndex = 4;
            this.lblMa_Sp.Text = "Mã sản phẩm";
            this.lblTk_Co.AutoSize = true;
            this.lblTk_Co.Font = new Font("Arial", 8.25f);
            this.lblTk_Co.Location = new Point(12, 0x1cf);
            this.lblTk_Co.Name = "lblTk_Co";
            this.lblTk_Co.Size = new Size(0x61, 14);
            this.lblTk_Co.TabIndex = 4;
            this.lblTk_Co.Text = "Tài khoản hao m\x00f2n";
            this.lblTk_No.AutoSize = true;
            this.lblTk_No.Font = new Font("Arial", 8.25f);
            this.lblTk_No.Location = new Point(0x166, 0x1cf);
            this.lblTk_No.Name = "lblTk_No";
            this.lblTk_No.Size = new Size(0x57, 14);
            this.lblTk_No.TabIndex = 4;
            this.lblTk_No.Text = "Tài khoản chi phí";
            this.lblMa_Km.AutoSize = true;
            this.lblMa_Km.Font = new Font("Arial", 8.25f);
            this.lblMa_Km.Location = new Point(0x171, 0x1e4);
            this.lblMa_Km.Name = "lblMa_Km";
            this.lblMa_Km.Size = new Size(0x4c, 14);
            this.lblMa_Km.TabIndex = 4;
            this.lblMa_Km.Text = "Mã khoản mục";
            this.txtMa_Sp.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Sp.CheckTextSearched = false;
            this.txtMa_Sp.DisabledForeColor = Color.Empty;
            this.txtMa_Sp.EmptyIsValid = true;
            this.txtMa_Sp.Font = new Font("Arial", 8.25f);
            this.txtMa_Sp.FoundIsValid = true;
            this.txtMa_Sp.Location = new Point(0x7b, 0x1e1);
            this.txtMa_Sp.MaxLength = 0x20;
            this.txtMa_Sp.Name = "txtMa_Sp";
            this.txtMa_Sp.OldValue = null;
            this.txtMa_Sp.Size = new Size(100, 20);
            this.txtMa_Sp.TabIndex = 0x1c;
            this.txtMa_Sp.TableName = "DMSP";
            this.txtMa_Sp.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Sp.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Sp.Value = null;//manager.GetObject("txtMa_Sp.Value");
            this.txtTk_Co.CharacterCasing = CharacterCasing.Upper;
            this.txtTk_Co.CheckTextSearched = false;
            this.txtTk_Co.DisabledForeColor = Color.Empty;
            this.txtTk_Co.FieldDisplay = "Ten_Nh_Vt";
            this.txtTk_Co.FirstFilter = "Loai_Tk = 'C'";
            this.txtTk_Co.Font = new Font("Arial", 8.25f);
            this.txtTk_Co.Location = new Point(0x7b, 460);
            this.txtTk_Co.MaxLength = 0x20;
            this.txtTk_Co.Name = "txtTk_Co";
            this.txtTk_Co.OldValue = null;
            this.txtTk_Co.Size = new Size(100, 20);
            this.txtTk_Co.TabIndex = 0x19;
            this.txtTk_Co.TableName = "DMTK";
            this.txtTk_Co.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtTk_Co.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk_Co.Value = null;//manager.GetObject("txtTk_Co.Value");
            this.txtTk_No.CharacterCasing = CharacterCasing.Upper;
            this.txtTk_No.CheckTextSearched = false;
            this.txtTk_No.DisabledForeColor = Color.Empty;
            this.txtTk_No.FieldDisplay = "Ten_Sp";
            this.txtTk_No.FirstFilter = "Loai_Tk = 'C'";
            this.txtTk_No.Font = new Font("Arial", 8.25f);
            this.txtTk_No.Location = new Point(0x1c3, 460);
            this.txtTk_No.MaxLength = 0x20;
            this.txtTk_No.Name = "txtTk_No";
            this.txtTk_No.OldValue = null;
            this.txtTk_No.Size = new Size(100, 20);
            this.txtTk_No.TabIndex = 0x1a;
            this.txtTk_No.TableName = "DMTK";
            this.txtTk_No.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtTk_No.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk_No.Value = null;//manager.GetObject("txtTk_No.Value");
            this.txtMa_Km.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Km.CheckTextSearched = false;
            this.txtMa_Km.DisabledForeColor = Color.Empty;
            this.txtMa_Km.EmptyIsValid = true;
            this.txtMa_Km.Font = new Font("Arial", 8.25f);
            this.txtMa_Km.FoundIsValid = true;
            this.txtMa_Km.Location = new Point(0x1c3, 0x1e1);
            this.txtMa_Km.MaxLength = 0x20;
            this.txtMa_Km.Name = "txtMa_Km";
            this.txtMa_Km.OldValue = null;
            this.txtMa_Km.Size = new Size(100, 20);
            this.txtMa_Km.TabIndex = 0x1d;
            this.txtMa_Km.TableName = "DMKM";
            this.txtMa_Km.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Km.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Km.Value = null;//manager.GetObject("txtMa_Km.Value");
            this.Column1.DataPropertyName = "Ma_TGTS";
            style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            this.Column1.DefaultCellStyle = style;
            this.Column1.DestinationFields = "Ten_TGTS, Loai_TGTS";
            this.Column1.DisabledForeColor = Color.Blue;
            this.Column1.EmptyIsValid = true;
            this.Column1.HeaderText = "L\x00fd do";
            this.Column1.Name = "Column1";
            this.Column1.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column1.SourceFields = "Ten_TGTS, Loai_TGTS";
            this.Column1.TableName = "DMTGTS";
            this.Column1.Width = 0x48;
            this.Column2.DataPropertyName = "Ten_TGTS";
            this.Column2.HeaderText = "Diễn giải";
            this.Column2.Name = "Column2";
            this.Column2.Width = 0xd1;
            this.Column3.DataPropertyName = "Ma_Nvon";
            style2.Alignment = DataGridViewContentAlignment.MiddleLeft;
            this.Column3.DefaultCellStyle = style2;
            this.Column3.DisabledForeColor = Color.Blue;
            this.Column3.HeaderText = "Nguồn vốn";
            this.Column3.Name = "Column3";
            this.Column3.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column3.TableName = "DMNVON";
            this.Column3.Width = 0x48;
            this.Column4.DataPropertyName = "Tien0";
            style3.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.Column4.DefaultCellStyle = style3;
            this.Column4.HeaderText = "Nguyên giá";
            this.Column4.Name = "Column4";
            this.Column4.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column4.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
            this.Column5.DataPropertyName = "Tien1";
            style4.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.Column5.DefaultCellStyle = style4;
            this.Column5.HeaderText = "Giá trị hao m\x00f2n";
            this.Column5.Name = "Column5";
            this.Column5.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column5.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
            this.Column5.ZeroIsValid = true;
            this.Column6.DataPropertyName = "Tien3";
            style5.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.Column6.DefaultCellStyle = style5;
            this.Column6.HeaderText = "Giá trị còn lại";
            this.Column6.Name = "Column6";
            this.Column6.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column6.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
            this.Column6.ZeroIsValid = true;
            this.Column7.DataPropertyName = "Tien4";
            style6.Alignment = DataGridViewContentAlignment.MiddleRight;
            this.Column7.DefaultCellStyle = style6;
            this.Column7.HeaderText = "Giá trị tính khấu hao";
            this.Column7.Name = "Column7";
            this.Column7.SortMode = DataGridViewColumnSortMode.Automatic;
            this.Column7.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
            this.Column7.ZeroIsValid = true;
            base.AddTitleText = "Thêm mới tài sản, công cụ";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.ClientSize = new Size(0x31c, 0x216);
            base.Controls.Add(this.txtTinh_KH);
            base.Controls.Add(this.grdDetail);
            base.Controls.Add(this.txtNgay_KH);
            base.Controls.Add(this.txtNgay_Ts);
            base.Controls.Add(this.txtNam_Sx);
            base.Controls.Add(this.txtTTien0);
            base.Controls.Add(this.txtTTien1);
            base.Controls.Add(this.txtTTien3);
            base.Controls.Add(this.lblTTien0);
            base.Controls.Add(this.txtTTien2);
            base.Controls.Add(this.lblTTien1);
            base.Controls.Add(this.txtSo_Thang);
            base.Controls.Add(this.txtSo_Luong);
            base.Controls.Add(this.lblTTien3);
            base.Controls.Add(this.lblNam_Sx);
            base.Controls.Add(this.lblNgay_KH);
            base.Controls.Add(this.lblTTien2);
            base.Controls.Add(this.lblSo_Thang);
            base.Controls.Add(this.lblNgay_Ts);
            base.Controls.Add(this.lblSo_Luong);
            base.Controls.Add(this.txtMa_Km);
            base.Controls.Add(this.txtMa_Bp);
            base.Controls.Add(this.pnlPicture);
            base.Controls.Add(this.txtTk_No);
            base.Controls.Add(this.txtTk_Co);
            base.Controls.Add(this.txtMa_MDSD);
            base.Controls.Add(this.txtMa_Sp);
            base.Controls.Add(this.txtMa_Nh_Ts);
            base.Controls.Add(this.txtTk);
            base.Controls.Add(this.lblCong_Suat);
            base.Controls.Add(this.lblTinh_KH0);
            base.Controls.Add(this.lblTinh_KH);
            base.Controls.Add(this.lblDesc_EN);
            base.Controls.Add(this.lblMa_Km);
            base.Controls.Add(this.lblTen_Ts_E);
            base.Controls.Add(this.lblTk_No);
            base.Controls.Add(this.lblMa_Bp);
            base.Controls.Add(this.lblTk_Co);
            base.Controls.Add(this.lblMa_MDSD);
            base.Controls.Add(this.lblMa_Sp);
            base.Controls.Add(this.lblMa_Nh_Ts);
            base.Controls.Add(this.lblTk);
            base.Controls.Add(this.lblDien_Giai);
            base.Controls.Add(this.lblTen_Ts);
            base.Controls.Add(this.lblSo_Ct_T);
            base.Controls.Add(this.lblNuoc_Sx);
            base.Controls.Add(this.lblDvt);
            base.Controls.Add(this.lblSo_Hieu);
            base.Controls.Add(this.lblThe_Ts);
            base.Controls.Add(this.lblMa_Ts);
            base.Controls.Add(this.txtCong_Suat);
            base.Controls.Add(this.txtDesc_EN);
            base.Controls.Add(this.txtTen_Ts_E);
            base.Controls.Add(this.txtDien_Giai);
            base.Controls.Add(this.txtTen_Ts);
            base.Controls.Add(this.txtSo_Ct_T);
            base.Controls.Add(this.txtNuoc_Sx);
            base.Controls.Add(this.txtDvt);
            base.Controls.Add(this.txtSo_Hieu);
            base.Controls.Add(this.txtThe_Ts);
            base.Controls.Add(this.txtMa_Ts);
            base.EditTitleText = "Sửa tài sản, công cụ";
            base.FirstFreeCode = "TS1";
            this.MinimumSize = new Size(0x322, 0x236);
            base.Name = "FormDmTsEditor";
            base.SecondFreeCode = "TS2";
            this.Text = "Thêm mới tài sản, công cụ";
            base.ThirdFreeCode = "TS3";
            base.Controls.SetChildIndex(base.lblPhan_Loai, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai1, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai2, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai3, 0);
            base.Controls.SetChildIndex(this.txtMa_Ts, 0);
            base.Controls.SetChildIndex(this.txtThe_Ts, 0);
            base.Controls.SetChildIndex(this.txtSo_Hieu, 0);
            base.Controls.SetChildIndex(this.txtDvt, 0);
            base.Controls.SetChildIndex(this.txtNuoc_Sx, 0);
            base.Controls.SetChildIndex(this.txtSo_Ct_T, 0);
            base.Controls.SetChildIndex(this.txtTen_Ts, 0);
            base.Controls.SetChildIndex(this.txtDien_Giai, 0);
            base.Controls.SetChildIndex(this.txtTen_Ts_E, 0);
            base.Controls.SetChildIndex(this.txtDesc_EN, 0);
            base.Controls.SetChildIndex(this.txtCong_Suat, 0);
            base.Controls.SetChildIndex(this.lblMa_Ts, 0);
            base.Controls.SetChildIndex(this.lblThe_Ts, 0);
            base.Controls.SetChildIndex(this.lblSo_Hieu, 0);
            base.Controls.SetChildIndex(this.lblDvt, 0);
            base.Controls.SetChildIndex(this.lblNuoc_Sx, 0);
            base.Controls.SetChildIndex(this.lblSo_Ct_T, 0);
            base.Controls.SetChildIndex(this.lblTen_Ts, 0);
            base.Controls.SetChildIndex(this.lblDien_Giai, 0);
            base.Controls.SetChildIndex(this.lblTk, 0);
            base.Controls.SetChildIndex(this.lblMa_Nh_Ts, 0);
            base.Controls.SetChildIndex(this.lblMa_Sp, 0);
            base.Controls.SetChildIndex(this.lblMa_MDSD, 0);
            base.Controls.SetChildIndex(this.lblTk_Co, 0);
            base.Controls.SetChildIndex(this.lblMa_Bp, 0);
            base.Controls.SetChildIndex(this.lblTk_No, 0);
            base.Controls.SetChildIndex(this.lblTen_Ts_E, 0);
            base.Controls.SetChildIndex(this.lblMa_Km, 0);
            base.Controls.SetChildIndex(this.lblDesc_EN, 0);
            base.Controls.SetChildIndex(this.lblTinh_KH, 0);
            base.Controls.SetChildIndex(this.lblTinh_KH0, 0);
            base.Controls.SetChildIndex(this.lblCong_Suat, 0);
            base.Controls.SetChildIndex(this.txtTk, 0);
            base.Controls.SetChildIndex(this.txtMa_Nh_Ts, 0);
            base.Controls.SetChildIndex(this.txtMa_Sp, 0);
            base.Controls.SetChildIndex(this.txtMa_MDSD, 0);
            base.Controls.SetChildIndex(this.txtTk_Co, 0);
            base.Controls.SetChildIndex(this.txtTk_No, 0);
            base.Controls.SetChildIndex(this.pnlPicture, 0);
            base.Controls.SetChildIndex(this.txtMa_Bp, 0);
            base.Controls.SetChildIndex(this.txtMa_Km, 0);
            base.Controls.SetChildIndex(this.lblSo_Luong, 0);
            base.Controls.SetChildIndex(this.lblNgay_Ts, 0);
            base.Controls.SetChildIndex(this.lblSo_Thang, 0);
            base.Controls.SetChildIndex(this.lblTTien2, 0);
            base.Controls.SetChildIndex(this.lblNgay_KH, 0);
            base.Controls.SetChildIndex(this.lblNam_Sx, 0);
            base.Controls.SetChildIndex(this.lblTTien3, 0);
            base.Controls.SetChildIndex(this.txtSo_Luong, 0);
            base.Controls.SetChildIndex(this.txtSo_Thang, 0);
            base.Controls.SetChildIndex(this.lblTTien1, 0);
            base.Controls.SetChildIndex(this.txtTTien2, 0);
            base.Controls.SetChildIndex(this.lblTTien0, 0);
            base.Controls.SetChildIndex(this.txtTTien3, 0);
            base.Controls.SetChildIndex(this.txtTTien1, 0);
            base.Controls.SetChildIndex(this.txtTTien0, 0);
            base.Controls.SetChildIndex(this.txtNam_Sx, 0);
            base.Controls.SetChildIndex(this.txtNgay_Ts, 0);
            base.Controls.SetChildIndex(this.txtNgay_KH, 0);
            base.Controls.SetChildIndex(this.grdDetail, 0);
            base.Controls.SetChildIndex(this.txtTinh_KH, 0);
            this.pnlPicture.ResumeLayout(false);
            ((ISupportInitialize) this.PictureBox).EndInit();
            ((ISupportInitialize) this.grdDetail).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnReset()
        {
            if (base.NewChecked)
            {
                if (base.LocalCurrentRow == null)
                {
                    this.oMasterRow = this.oMethod.GetMasterDataRow("AppSOFT2009");
                }
                this.oMasterRow["Stt"] = AppDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
                this.oMasterRow["Ngay_Ts"] = DateTime.Today;
                this.oMasterRow["Ngay_KH"] = DateTime.Today;
                this.oMasterRow["So_Thang"] = 0;
                this.oMasterRow["TTien0"] = 0;
                this.oMasterRow["TTien1"] = 0;
                this.oMasterRow["TTien2"] = 0;
                this.oMasterRow["TTien3"] = 0;
                this.oMasterRow["TTien4"] = 0;
                if (this.oDetailTable == null)
                {
                    this.oDetailTable = this.oMethod.GetDetailTable(this.oMasterRow["Stt"]);
                }
                DataRow row = this.oDetailTable.NewRow();
                row["Stt0"] = AppDataAccess.Cong_So_Tt(AppInstance.Subsidiary);
                row["Tien0"] = 0;
                row["Tien1"] = 0;
                row["Loai_TGTS"] = "T";
                row["Tien3"] = 0;
                row["Tien4"] = 0;
                this.oDetailTable.Rows.Clear();
                this.oDetailTable.Rows.Add(row);
                if ((base.LocalCurrentRow == null) && (base.LocalFormLister.ParentCurrentRow != null))
                {
                    this.txtMa_Nh_Ts.Text = base.LocalFormLister.ParentCurrentRow[base.LocalFormLister.ParentFieldName].ToString();
                }
            }
            else
            {
                this.oDetailTable = this.oMethod.GetDetailTable(this.oMasterRow["Stt"]);
            }
            this.txtNgay_Ts.Value = this.oMasterRow["Ngay_Ts"];
            this.txtNgay_KH.Value = this.oMasterRow["Ngay_KH"];
            this.txtSo_Thang.Value = this.oMasterRow["So_Thang"];
            this.txtTTien0.Value = this.oMasterRow["TTien0"];
            this.txtTTien1.Value = this.oMasterRow["TTien1"];
            this.txtTTien3.Value = this.oMasterRow["TTien3"];
            this.txtTTien2.Value = this.oMasterRow["TTien2"];
            this.grdDetail.DataSource = new BindingSource(this.oDetailTable, this.oDetailTable.TableName);
            base.OnReset();
        }

        public override bool OnSave()
        {
            DataRow localCurrentRow;
            if (string.IsNullOrEmpty(this.txtMa_Ts.Text))
            {
                MessageBox.Show("Chưa nhập mã tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtThe_Ts.Text))
            {
                MessageBox.Show("Chưa nhập số thẻ tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtSo_Hieu.Text))
            {
                MessageBox.Show("Chưa nhập số hiệu tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtTen_Ts.Text))
            {
                MessageBox.Show("Chưa nhập tên tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtDvt.Text))
            {
                MessageBox.Show("Chưa nhập đơn vị tính!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtMa_Nh_Ts.Text))
            {
                MessageBox.Show("Chưa nhập mã nhóm tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtNgay_Ts.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày tăng tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtNgay_KH.Value.Equals(DBNull.Value))
            {
                MessageBox.Show("Chưa nhập ngày tính khấu hao!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtSo_Luong.NumericValue == 0M)
            {
                MessageBox.Show("Chưa nhập số lượng tài sản!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (this.txtSo_Thang.NumericValue == 0M)
            {
                MessageBox.Show("Chưa nhập số tháng khấu hao!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            this.oMasterRow["Ma_Dvcs"] = AppInstance.Subsidiary;
            this.oMasterRow["Ma_Ts"] = this.txtMa_Ts.Value;
            this.oMasterRow["The_Ts"] = this.txtThe_Ts.Value;
            this.oMasterRow["So_Hieu"] = this.txtSo_Hieu.Value;
            this.oMasterRow["Ten_Ts"] = this.txtTen_Ts.Value;
            this.oMasterRow["Ten_Ts_E"] = this.txtTen_Ts_E.Value;
            this.oMasterRow["Dvt"] = this.txtDvt.Value;
            this.oMasterRow["Loai_Ts"] = this.FixedAssetType;
            this.oMasterRow["So_Luong"] = this.txtSo_Luong.Value;
            this.oMasterRow["So_Ct_T"] = this.txtSo_Ct_T.Value;
            this.oMasterRow["Ngay_Ts"] = this.txtNgay_Ts.Value;
            this.oMasterRow["Nuoc_Sx"] = this.txtNuoc_Sx.Value;
            this.oMasterRow["Nam_Sx"] = this.txtNam_Sx.Value;
            this.oMasterRow["Cong_Suat"] = this.txtCong_Suat.Value;
            this.oMasterRow["Ma_Nh_Ts"] = this.txtMa_Nh_Ts.Value;
            this.oMasterRow["Stt_Nh_Ts"] = this.txtMa_Nh_Ts.GetFieldData("Stt_Nh_Ts");
            this.oMasterRow["Ma_MDSD"] = this.txtMa_MDSD.Value;
            this.oMasterRow["Tk"] = this.txtTk.Value;
            this.oMasterRow["Ma_Bp"] = this.txtMa_Bp.Value;
            this.oMasterRow["Dien_Giai"] = this.txtDien_Giai.Value;
            this.oMasterRow["Desc_EN"] = this.txtDesc_EN.Value;
            this.oMasterRow["Tinh_KH"] = this.txtTinh_KH.Value;
            this.oMasterRow["Ngay_KH"] = this.txtNgay_KH.Value;
            this.oMasterRow["So_Thang"] = this.txtSo_Thang.Value;
            this.oMasterRow["Tk_Co"] = this.txtTk_Co.Value;
            this.oMasterRow["Tk_No"] = this.txtTk_No.Value;
            this.oMasterRow["Ma_Sp"] = this.txtMa_Sp.Value;
            this.oMasterRow["Ma_Km"] = this.txtMa_Km.Value;
            this.oMasterRow["TTien0"] = this.txtTTien0.Value;
            this.oMasterRow["TTien1"] = this.txtTTien1.Value;
            this.oMasterRow["TTien3"] = this.txtTTien3.Value;
            this.oMasterRow["TTien2"] = this.txtTTien2.Value;
            this.oMasterRow["Ma_Loai1"] = base.txtMa_Loai1.Value;
            this.oMasterRow["Ma_Loai2"] = base.txtMa_Loai2.Value;
            this.oMasterRow["Ma_Loai3"] = base.txtMa_Loai3.Value;
            if (!this.oMethod.Save(base.NewChecked, this.oMasterRow, this.oDetailTable))
            {
                MessageBox.Show("Mã tài sản đã tồn tại!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            foreach (DataColumn column in localCurrentRow.Table.Columns)
            {
                if (this.oMasterRow.Table.Columns.Contains(column.ColumnName))
                {
                    localCurrentRow[column.ColumnName] = this.oMasterRow[column.ColumnName];
                }
            }
            if (this.ib_PictureChanged)
            {
                AppDataAccess.SetPicture(base.LocalFormLister.LocalTableName, base.LocalFormLister.LocalKeyField, this.oMasterRow[base.LocalFormLister.LocalKeyField], "Image_Name", "Image_Item", this.is_PicturePath);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtMa_Ts.Focus();
            return base.OnSave();
        }

        public override void OnShow()
        {
            this.oMasterRow = this.oMethod.GetMasterDataRow(base.LocalCurrentRow["Stt"]);
            this.txtMa_Ts.Value = this.oMasterRow["Ma_Ts"];
            this.txtThe_Ts.Value = this.oMasterRow["The_Ts"];
            this.txtSo_Hieu.Value = this.oMasterRow["So_Hieu"];
            this.txtTen_Ts.Value = this.oMasterRow["Ten_Ts"];
            this.txtTen_Ts_E.Value = this.oMasterRow["Ten_Ts_E"];
            this.txtDvt.Value = this.oMasterRow["Dvt"];
            this.txtSo_Luong.Value = this.oMasterRow["So_Luong"];
            this.txtSo_Ct_T.Value = this.oMasterRow["So_Ct_T"];
            this.txtNuoc_Sx.Value = this.oMasterRow["Nuoc_Sx"];
            this.txtNam_Sx.Value = this.oMasterRow["Nam_Sx"];
            this.txtCong_Suat.Value = this.oMasterRow["Cong_Suat"];
            this.txtMa_Nh_Ts.Value = this.oMasterRow["Ma_Nh_Ts"];
            this.txtMa_MDSD.Value = this.oMasterRow["Ma_MDSD"];
            this.txtTk.Value = this.oMasterRow["Tk"];
            this.txtMa_Bp.Value = this.oMasterRow["Ma_Bp"];
            this.txtDien_Giai.Value = this.oMasterRow["Dien_Giai"];
            this.txtDesc_EN.Value = this.oMasterRow["Desc_EN"];
            this.txtTinh_KH.Value = this.oMasterRow["Tinh_KH"];
            this.txtTk_Co.Value = this.oMasterRow["Tk_Co"];
            this.txtTk_No.Value = this.oMasterRow["Tk_No"];
            this.txtMa_Sp.Value = this.oMasterRow["Ma_Sp"];
            this.txtMa_Km.Value = this.oMasterRow["Ma_Km"];
            base.txtMa_Loai1.Value = this.oMasterRow["Ma_Loai1"];
            base.txtMa_Loai2.Value = this.oMasterRow["Ma_Loai2"];
            base.txtMa_Loai2.Value = this.oMasterRow["Ma_Loai2"];
            this.PictureBox.Image = AppDataAccess.GetPicture(base.LocalFormLister.LocalTableName, base.LocalFormLister.LocalKeyField, this.oMasterRow[base.LocalFormLister.LocalKeyField], "Image_Name", "Image_Item");
            base.OnShow();
        }

        private void PictureBox_DoubleClick(object sender, EventArgs e)
        {
            this.ib_PictureChanged = true;
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = "";
            dialog.Filter = "JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)|*.jpg;*.jpeg;*.jpe;*.jfif|Bitmap files (*.bmp)|*.bmp|GIF (*.gif)|*.gif|TIFF (*.tif;*.tiff)|*.tif;*.tiff|All files (*.*)|*.*";
            dialog.CheckFileExists = true;
            dialog.ShowDialog();
            this.is_PicturePath = dialog.FileName;
            if (!this.is_PicturePath.Equals(string.Empty))
            {
                this.PictureBox.Image = new Bitmap(this.is_PicturePath);
            }
            else
            {
                this.PictureBox.Image = null;
            }
        }

        private bool Sum()
        {
            DataRow row = ((DataRowView) this.grdDetail.CurrentRow.DataBoundItem).Row;
            row["Tien3"] = ((decimal) row["Tien0"]) - ((decimal) row["Tien1"]);
            row["Tien4"] = (((decimal) row["Tien4"]) == 0M) ? row["Tien0"] : row["Tien4"];
            decimal num = 0M;
            decimal num2 = 0M;
            decimal num3 = 0M;
            decimal num4 = 0M;
            foreach (DataRow row2 in this.oDetailTable.Rows)
            {
                if (row2.RowState != DataRowState.Deleted)
                {
                    if (((string) row2["Loai_TGTS"]) == "T")
                    {
                        num += (decimal) row2["Tien0"];
                        num2 += (decimal) row2["Tien1"];
                        num3 += (decimal) row2["Tien3"];
                        num4 += (decimal) row2["Tien4"];
                    }
                    else
                    {
                        num -= (decimal) row2["Tien0"];
                        num2 -= (decimal) row2["Tien1"];
                        num3 -= (decimal) row2["Tien3"];
                        num4 -= (decimal) row2["Tien4"];
                    }
                }
            }
            this.txtTTien0.Value = num;
            this.txtTTien1.Value = num2;
            this.txtTTien2.Value = (this.txtSo_Thang.NumericValue != 0M) ? decimal.Round(num4 / this.txtSo_Thang.NumericValue, AppInstance.LCAmountDecimals) : 0M;
            this.txtTTien3.Value = num3;
            this.oMasterRow["TTien4"] = num4;
            return true;
        }

        private void txtSo_Thang_Validated(object sender, EventArgs e)
        {
            this.Sum();
        }

        public string FixedAssetType
        {
            get
            {
                return this.is_FixedAssetType;
            }
            set
            {
                this.is_FixedAssetType = value;
            }
        }
    }
}

